/*
window.Business = Backbone.Model.extend({
    //urlRoot:"api/message",
    urlRoot:"api/message",
    defaults:{
        "id":null,
        "name":"",
        "bio":"",
        "overview":"USA",
        "city":"Hochiminh"
    }
});
*/


define([
    'jquery',
    'underscore',
    'backbone',
    'models/message',
    'collections/messages',
    'backboneRelational'
], function($, _, Backbone,MessageModel, MessageCollection) {

    var ThreadModel = Backbone.RelationalModel.extend({

        urlRoot: 'api/thread',
        /*defaults:{
            "id":null,
            "message_id":"",
            "user_id":"",
            "ownership":"",
            "saveOnly":1
        }*/

        relations: [
            {
                type: Backbone.HasMany,
                key: 'messages',
                relatedModel: MessageModel,
                collectionType: MessageCollection,
                reverseRelation: {
                    key: 'thread',
                    keySource: 'thread_id',
                    includeInJSON: Backbone.Model.prototype.idAttribute
                }
            }
        ]

    });

    return ThreadModel;
});
